package com.wty.design.structural.flyWeight;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author wangtengyu
 * @Create 2018-09-19-14:33
 */
public class EmployeeFactory {

    private static final Map<String,Object> EMPLOYEE_MAP=new HashMap<String,Object>();

    public static Employee getManager(String department){

        if (EMPLOYEE_MAP.get(department)==null){
            System.out.println("创建部门经理"+department);
            Manager manager=new Manager(department);
            String reportContent=new String(department+"部门汇报，汇报内容是....");
            manager.setReportContent(reportContent);
            System.out.println("创建报告"+reportContent);
            EMPLOYEE_MAP.put(department,manager);
        }
        return (Employee) EMPLOYEE_MAP.get(department);

    }
}
